<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <base href="<?php echo base_url(); ?>"/>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title><?php echo $khachsan[0]->Ten . ' tại ' . $khachsan[0]->Tinh_ThanhPho; ?></title>
        
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/reset.css" />
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/960.css" />
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/style.css" />
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/search_style.css" />
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/styleDate.css" />
        <link rel="stylesheet" type="text/css" media="all" href="resources/home/css/calendar.css" />
        <link rel="stylesheet" href="resources/home/css/date_input.css" type="text/css" />
        <link rel="stylesheet" href="resources/home/css/screen_ivivu.css" type="text/css"/>        
        <link rel="stylesheet" type="text/css" href="resources/home/css/superfish.css" media="screen" />
		<link rel="stylesheet" type="text/css" href="resources/home/css/skin.css" />
		<link rel="stylesheet" type="text/css" href="resources/home/css/slimbox2.css" />        
        <link rel="stylesheet" type="text/css" href="resources/home/css/cupertino/jquery-ui-1.9.2.custom.min.css" /> 
        <link rel="stylesheet" type="text/css" href="resources/home/css/compare.css" />
    	<link rel="stylesheet" type="text/css" href="resources/home/css/jquery.tooltip.css" />        
        
        <script type="text/javascript" src="resources/home/scripts/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="resources/home/scripts/jquery-1.4.2.min.js"></script>   
        <script type="text/javascript" src="resources/home/scripts/jquery-1.5.2.min.js"></script>
        <script type="text/javascript" src="resources/home/scripts/jquery-1.8.3.js"></script>
        <script type="text/javascript" src="resources/home/scripts/jquery.min.js"></script>        
        <script type="text/javascript" src="resources/home/scripts/jquery.date_input.js"></script>
        <script type="text/javascript" src="resources/home/scripts/calendar.js"></script>
		<script type="text/javascript" src="resources/home/scripts/jquery.datePicker.js"></script>         
		<script type="text/javascript" src="resources/home/scripts/jquery.date.js"></script>        
		<script type="text/javascript" src="resources/home/scripts/jquery.jcarousel.min.js"></script>
		<script type="text/javascript" src="resources/home/scripts/slimbox2.js"></script>
		<script type="text/javascript" src="resources/home/scripts/jquery-ui-1.9.2.custom.min.js"></script>              
		
		<script type="text/javascript" src="resources/home/scripts/jquery.min.js"></script>
		<script type="text/javascript" src="resources/home/scripts/jquery.tooltip.js"></script>	
		<script type="text/javascript">
          $j = jQuery.noConflict();
          $j(document).ready(function(){
            $j("div.item").tooltip();
          });
        </script>
        <!--[if IE]>
        <link rel="stylesheet" media="all" type="text/css" href="css/pro_dropline_ie.css" />
        <![endif]-->

        <!--<script type="text/javascript" src="resources/home/scripts/jquery-1.8.2.js"></script>
        <script type="text/javascript" src="resources/home/scripts/jquery-ui.js"></script>-->
        <script type="text/javascript">
			jQuery(document).ready(function() 
			{
    			jQuery('#mycarousel').jcarousel(
				{
					visible: 4,
					scroll: 4
			    });
			});			
        </script>
        
		<script type="text/javascript">
			$(function()
			{
				$('#sosanh').click(function()
				{
					if($(this).text() == "So sánh")
					{
						$(this).attr("class", "remove vi");
						$(this).text("Xóa");
						
						var select_data = {
											maks: $("#makhachsan").val(),
											tenks: $("#tenkhachsan").val()
											};

						$.ajax(
						{
						   url: "index.php/sosanh/Them",
						   type: 'POST',
						   data: select_data,
						   success: function(msg)
						   {
							  $('#listsosanh').html(msg);
						   },
						});						
					}
					else
					{	
						$(this).attr("class", "save vi");
						$(this).text("So sánh");	
						
						var maks = $("#makhachsan").val();
						var id = '#' + maks;
						
						var select_data = {
											rowid: $(id).parent().attr('id')
											};

						$.ajax(
						{
						   url: "index.php/sosanh/Xoa",
						   type: 'POST',
						   data: select_data,
						   success: function(msg)
						   {
							  $('#listsosanh').html(msg);
						   },
						});												
					}
				});
			});
		</script>        

        <script type="text/javascript">$($.date_input.initialize);</script>

        <!-- End menu css and js files here -->
        <!-- Begin featured slider css & js files -->
        <script type="text/javascript" src="resources/home/scripts/datphong.js"></script>
        <!-- End featured slider css & js files -->
        <!--[if IE 6]>
        <script type='text/javascript' src='js/dd_belated_png.js'></script>
        <script>DD_belatedPNG.fix('.pngfix');</script>
        <![endif]-->
        
        <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBzGtzdQUaDE6W6atphNvL1GOzA70ipw5o&sensor=true"></script>
		<script>
        	var geocoder;
	        var map;
			function initialize() 
			{
            	geocoder = new google.maps.Geocoder();
	            var latlng = new google.maps.LatLng(10.762495, 106.682428);
    	        var mapOptions = 
				{
	              zoom: 16,
    	          center: latlng,
        	      mapTypeId: google.maps.MapTypeId.ROADMAP
            	}
	            map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
			}
        
          	function codeAddress() 
			{
            	var address = document.getElementById("address").value;
	            geocoder.geocode( { 'address': address}, function(results, status) 
				{
	              if (status == google.maps.GeocoderStatus.OK) 
				  {
	                map.setCenter(results[0].geometry.location);
    	            var marker = new google.maps.Marker(
					{
                    	map: map,
                    	position: results[0].geometry.location
	                });
    	          } 
				  else 
				  {
					alert("Geocode was not successful for the following reason: " + status);
	              }
    	        });
				DisplayMap(1);				
			}
			
			function DisplayMap(display)
			{
				if(display == 1)
				{
					document.getElementById("map_canvas").style.display = "block";
					document.getElementById("div_show_map").innerHTML = "<a href='javascript:void(0);' onclick='DisplayMap(0);'> Ẩn bản đồ</a>";
				}
				else
				{
					document.getElementById("map_canvas").style.display = "none";
					document.getElementById("div_show_map").innerHTML = "<a href='javascript:void(0);' onclick='DisplayMap(1);'> Bản đồ khách sạn</a>";
				}
			}
        </script>

    </head>
    <body onload="load_();">
        <div class="subbg">
            <div class="subheader">  <!--start:header -->
                <div class="container_16">
                    <!--start:header container -->
                    <!--start:logo -->
                    <div class="grid_5"> 
                        <a href="index.php/home"><img src="resources/home/images/logo.png" alt="DesignPlus" class="pngfix logo"/></a>
                    </div>
                    <!--end:logo -->
                    <div class="grid_11">
                        <!--start:menu grid -->
                        <div class="top-menu pngfix">
                            <!--start:menu top-menu -->
                            <ul class="sf-menu">
                                <!--start:sf-menu -->
                                <li> <a href="<?php echo site_url('home'); ?>">Trang chủ</a> </li>
                                <li> <a href="<?php echo site_url('GioiThieu'); ?>">Giới thiệu</a> </li>
                                <li> <a href="<?php echo site_url('khuyenmai'); ?>">Khuyến mãi</a></li>
                                <li> <a href="<?php echo site_url('nhacungcap'); ?>">Đối tác</a> </li>
                                <li> <a href="<?php echo site_url('LienHe'); ?>">Liên hệ - Hỗ trợ</a> </li>
                            </ul>
                            <!--end:sf-menu -->
                            <span class="rightcorner pngfix"></span> </div>
                        <!--end:menu top-menu -->
                    </div>
                    <!--end:menu grid -->
                    <div class="clear">&nbsp;</div>
                    <div class="grid_16">
                    	<div id="listsosanh">
							<?php $this->load->view('home/danhsach_sosanh_view'); ?>
                        </div>
                        <!--Begin Search form-->
                        <div class="searchform">
                            <div class="header_02">
                                <div class="moduletable">
                                    <div class="layout_search_page"><div id="from_search_booking" class='vi'>

                                            <div id="archor_search" style="position: absolute; top: 10px;"></div>
                                            <div class="wrap"></div>
                                            <?php $this->load->view('home/timkiem_view'); ?>
                                            
                                        </div>

                                    </div><!--End moduleTable-->

                                </div><!--End Header_02-->
                                <!--<p>Khu vực đặt khung search</p>-->
<!--<p>Khu vực đặt khung search</p>-->
                            </div>
                            <!--End Search Form-->
                        </div>

                    </div>
                    <!--end:header container -->
                </div>
            </div>
            <!--end:header -->
            <div class="clear">&nbsp;</div>
            <div class="container_16">
                <!--start:content container -->
                <div class="box-content">
                    <!--start:box-content -->

                    <form action="<?php echo site_url('datphong/chitietdat'); ?>" id="myform" method="post">
                        <input type="hidden" value='<?php echo 0; ?>' id="ngaybatdau" name="ngaybatdau"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="thangbatdau" name="thangbatdau"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="nambatdau" name="nambatdau"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="ngayketthuc" name="ngayketthuc"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="thangketthuc" name="thangketthuc"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="namketthuc" name="namketthuc"/>
                        <input type="hidden" value="<?php echo $records1['khachsan']; ?>" id="makhachsan" name="makhachsan"/>
                        <input type="hidden" value='<?php echo 0; ?>' id="sodemo" name="sodemo"/>
                        <input type="hidden" value="" id="loaiphong" name="loaiphong"/>
                    </form>
                    <div id="hotelheader">

                        <h1 class="first_title" id="hotelName"><a href="index.php/datphong/khachsan/<?php echo $records1['khachsan']; ?>"><?php echo $khachsan[0]->Ten; ?>&nbsp;<img style="" src="<?php echo 'resources/home/images/template/star' . $khachsan[0]->TieuChuan . '.0.png'; ?>"></a> </h1> 
                        <div class="wrap"></div>
                        <div style="font-size:11px;color:#666666;">
							<?php
                                $diachi = $khachsan[0]->SoNha . ' ' . $khachsan[0]->Duong;
                            	if ($khachsan[0]->Quan != '')
                                	$diachi = $diachi . ', ' . $khachsan[0]->Quan;
                                $diachi = $diachi . ', ' . $khachsan[0]->Tinh_ThanhPho . ', ' . $khachsan[0]->QuocGia;
                                echo $diachi;
                            ?>
                        	<input type="hidden" id="address" value="<?php echo $diachi; ?>" />
                        	<input type="hidden" id="tenkhachsan" value="<?php echo $khachsan[0]->Ten; ?>" />
                        </div>
                        <ul class="ul_viewmap" style="padding-top:10px;">
                            <li><div id="div_show_map" style="padding: 0px 0px 0px 20px;"><a id="chonbando" href="javascript:initialize(); codeAddress();" > Bản đồ khách sạn</a></div></li>
                            
                            <?php
								$k = 0;
								foreach($this->cart->contents() as $row)
								{	
									if($row['id'] == $records1['khachsan'])
										$k = 1;
								}
								
								if($k == 0)
	                            	echo "<li style='font-size: 11px !important;'><div class='favorite'><a href='javascript:void(0);' class='save vi' style='padding: 0px 0px 0px 18px;' id='sosanh'>So sánh</a></div></li>";
								else
									echo "<li style='font-size: 11px !important;'><div class='favorite'><a href='javascript:void(0);' class='remove vi' style='padding: 0px 0px 0px 18px;' id='sosanh'>Xóa</a></div></li>";
							?>
                            
                        </ul>
                        
                    </div>
                    <div class="slide-image">
                        <div class="slider_layout" id="sidebar">
                            <div class="slider_wrapper">
                                <div class="bx-window">
                                    <ul id="mycarousel" class="jcarousel-skin-tango">
                                    <?php
										if($hinhanh)
										{
											foreach($hinhanh as $ha)
											{
												$small = $ha->HinhNho;
												$big = $ha->HinhLon;
												echo "<li><a href='$big' rel='lightbox[portfolio]'><img src='$small' width='95' height='75' alt='' /></a></li>";
											}
										}
									?>
								    </ul>
                                </div>
                            </div>
                       </div>
                    </div>
                    <div style="min-height:130px;"></div>
                    <div id="map_canvas" style="width: 940px; height: 350px; display:none"></div>
                    <div id="hotel">
						<center><h3 style="border-bottom: 1px dotted #A5AEC5;width:915px;padding-left: 30px;"></h3></center>                    
                        <div style="padding-top: 0px;">
                            <h2 style="color:black; width:100%; float:left;" >Thông tin <?php echo $khachsan[0]->Ten; ?></h2>
                        </div>

                        <div class="hotel-info-text">
                            <?php echo $khachsan[0]->ThongTin; ?>

                        </div>

                        <div class="" id="div_headrate" style="color:black;padding-left:0!important;">                 
                            <h2 style="color:black; padding-left:0!important;width:1000px;"> Bảng giá tại <?php echo $khachsan[0]->Ten; ?></h2>
                        </div>
                        <div id="banggia" style="width: 960px;">
                            <div id="dates">
                                <div id="head-row" style="padding-right:0px;">
                                    <table class="dates-table">
                                        <tbody id="head-row">
                                            <tr id="months-row">
                                                <th id="col1" class="th-checkin-date" title="">
                                                    <div style="margin-left:0px !important;" id="search-date-from"> Đổi ngày nhận phòng <input class="hasDatepicker" id="search-from" value="<?php echo date("d/m/Y"); ?>" type="text" onfocus="showCalendarControl(this);"/>
                                                    </div>
                                                </th>
                                                <th id="col2" class="fullrate">
                                                    <div id="display_rates">
                                                        <a class="changedate" href="javascript:getDealNo();">Đổi ngày </a>
                                                    </div>
                                                </th>
                                                <?php
                                                $d = $songay - $ngay + 1;
												$ts = mktime(0, 0, 0, $thang, $ngay, $nam);
												$date1 = date("Y-m-d", $ts);
												$now = date("Y-m-d");
                                                if ($d >= 14) {
                                                    ?>
                                                    <th class="month endofmonth" colspan="14">
                                                        <div class="month-inner">
                                                            <span class="label" style="margin-top: 2px;"><?php echo 'Tháng ' . $thang . ', ' . $nam; ?></span>
                                                            <a href="javascript:void(0)" class="button  zzz" id="nextbutton" title=" 7 ngày tới"> 7 ngày tới</a>
                                                        </div>
                                                        <input id="startMonthId" value="" type="hidden"/>
                                                    </th>
                                                <?php } else { ?>
                                                    <th class="month endofmonth" colspan="<?php echo $d; ?>">
                                                        <div class="month-inner">
                                                            <span class="label" style="margin-top: 2px;"><?php if ($d > 2) echo 'Tháng ' . $thang . ', ' . $nam; ?></span>
                                                        </div>
                                                        <input id="startMonthId" value="" type="hidden"/>
                                                    </th>
                                                    <th class="month startofmonth" colspan="<?php
                                                $d = 14 - $d;
                                                echo $d;
                                                    ?>">
                                                        <div class="month-inner">
                                                            <span class="label" style="margin-top: 2px;"><?php
                                                    $t = $thang + 1;
                                                    if ($t > 12)
                                                        $t = 1; if ($d > 2)
                                                        echo 'Tháng ' . $t . ', ' . $nam;
                                                    ?></span>
                                                            <a href="javascript:void(0)" class="button  zzz" id="nextbutton" title=" 7 ngày tới"> 7 ngày tới</a>
                                                        </div>
                                                        <input id="startMonthId" value="" type="hidden"/>
                                                    </th>
                                                <?php } ?>
                                            </tr>
                                            <tr class="head-row">
                                                <th id="col1" class="property" title="">
                                                    <div class="property-inner">
                                                        <span class="label"> Loại phòng</span>
                                                    </div>
                                                </th>
                                                <th id="col2" class="fullrate">
                                                    <div class="property-inner">
                                                        <span class="label"> Giá công bố</span>
                                                    </div>
                                                </th>
                                                <?php
                                                $endmonth = -1;
                                                $dayofweek = $thu;
                                                for ($i = 0; $i < 14; $i++) {
                                                    ?>
                                                    <td id="col3">
                                                        <div class="date-inner">
                                                            <span class="day"><?php if ($dayofweek == 1) echo 'CN'; else echo 'T' . $dayofweek; ?></span><br>
                                                                <span class="number"><?php
                                                $d = $ngay + $i;
                                                if ($d < $songay + 1)
                                                    echo $d; else {
                                                    $d = $d - $songay;
                                                    echo $d;
                                                    if ($d == 1)
                                                        $endmonth = $i - 1;
                                                }
                                                    ?>  </span>
                                                        </div>
                                                    </td>
                                                    <?php
                                                    $dayofweek = $dayofweek + 1;
                                                    if ($dayofweek > 7)
                                                        $dayofweek = 1;
                                                }
                                                ?>
                                                <input id="datefrom" value="2012-11-17" type="hidden"/>
                                            </tr>
                                            <tr id="dates-row">
                                                <th style="text-align:left;" colspan="2">Vui lòng chọn số đêm ở tại đây&nbsp;
                                                    <img src="resources/home/images/shared/arrow1_061.gif"/>
                                                </th>
                                                <?php for ($i = 0; $i < 14; $i++) {
                                                    ?>
                                                    <td class="date weekend <?php if ($i == $endmonth) echo 'endofmonth' ?>">
                                                        <input id="deal<?php echo $i; ?>" type="checkbox" name="chk" onclick="Check(<?php echo $i; ?>)"/>
                                                    </td>
                                                <?php }
                                                ?>
                                            </tr>
                                        </tbody>
                                        <?php
                                        $n = $ngay + 7;
                                        if ($n < $songay) {
                                            $ngay_ = $n;
                                            $thang_ = $thang;
                                        } else {
                                            $ngay_ = $n - $songay;
                                            $thang_ = $thang + 1;
                                        }
                                        $nam_ = $nam;
                                        if ($thang_ == 13) {
                                            $thang_ = 1;
                                            $nam_ = $nam_ + 1;
                                        }
                                        $ts = mktime(0, 0, 0, $thang_, 1, $nam_);
                                        $songay_ = date('t', $ts);
                                        ?>
                                        <input type="hidden" value="<?php echo $ngay; ?>" name="ngay" id="ngay"/>
                                        <input type="hidden" value="<?php echo $thang; ?>" name="thang" id="thang"/>
                                        <input type="hidden" value="<?php echo $nam; ?>" name="nam" id="nam"/>
                                        <input type="hidden" value="<?php echo $songay; ?>" name="songay" id="songay"/>
                                        <input type="hidden" value="<?php echo $ngay_; ?>" name="ngay1" id="ngay1"/>
                                        <input type="hidden" value="<?php echo $thang_; ?>" name="thang1" id="thang1"/>
                                        <input type="hidden" value="<?php echo $nam_; ?>" name="nam1" id="nam1"/>
                                        <input type="hidden" value="<?php echo $songay_; ?>" name="songay1" id="songay1"/>
                                        <input type="hidden" value="<?php echo $thu; ?>" name="thu" id="thu"/>
                                        <?php
                                        $n = $ngay - 7;
                                        $nam_2 = $nam;
                                        $thang_2 = $thang;
                                        if ($n >= 0) {
                                            $ngay_2 = $n;
                                        } else {
                                            $thang_2 = $thang - 1;
                                            if ($thang_2 == 0) {
                                                $thang_2 = 12;
                                                $nam_2 = $nam - 1;
                                            }
                                            $ts = mktime(0, 0, 0, $thang_2, 1, $nam_2);
                                            $songay_2 = date('t', $ts);
                                            $ngay_2 = $n + $songay_2;
                                        }
                                        $ts = mktime(0, 0, 0, $thang_2, 1, $nam_2);
                                        $songay_2 = date('t', $ts);
                                        ?>
                                        <input type="hidden" value="<?php echo $ngay_2; ?>" name="ngay2" id="ngay2"/>
                                        <input type="hidden" value="<?php echo $thang_2; ?>" name="thang2" id="thang2"/>
                                        <input type="hidden" value="<?php echo $nam_2; ?>" name="nam2" id="nam2"/>
                                        <input type="hidden" value="<?php echo $songay_2; ?>" name="songay2" id="songay2"/>
                                        <input type="hidden" value="<?php echo $thu; ?>" name="thu2" id="thu2"/>
                                    </table>
                                </div>
                            </div>
                            <div class="" style="padding-right:0px;">
                                <?php
                                $j = 0;
                                foreach ($records as $row):
                                    ?>
                                    <div class="room">
                                        <table id="tab_book_<?php echo $j; ?>" class="deals select-col1">
                                            <tbody>
                                                <tr id="property-1" class="rate valid" style="padding-left:0px !important;">
                                                    <!--AdvancePurchase PoolVilla-->

                                                    <th class="col1 property" style="padding-left:0px !important;">
                                                        <a href="javascript:;" class="name hotelname_1"><?php echo $row->Ten; ?></a>
                                                        <span class="guests"><span id="min_nigth_stay"  > tối thiểu = <?php echo $row->SoDemToiThieu ?> đêm</span><br/> Giá cho <?php echo $row->SoNguoiLonMacDinh ?> người (Tối đa <?php echo $row->SoNguoiToiDa ?>).</span>
                                                        <input type="hidden" id="min_nigth_stay_<?php echo $row->MaLP; ?>" value="<?php echo $row->SoDemToiThieu ?>"/>
                                                        <div>
                                                            <a id="<?php echo $row->MaLP; ?>" style="margin-left:167px;margin-top: -10px;position:absolute;" class="book button vi"  href="javascript: submitform('<?php echo $row->MaLP; ?>')"   >BOOK_IVIVU</a>
                                                        </div>
                                                    </th>

                                                    <th class="col2 fullrateroom">
                                                        <span class="label"><div class="price_fullrate"><?php echo number_format($row->GiaTruocKhuyenMai * 1000,  0, ',', '.'); ?></div>VND</span>
                                                    </th>
                                                    <?php
                                                    $dayofweek = date('w') + 1;
                                                    for ($i = 0; $i < 14; $i++) {
                                                        ?>
                                                        <td class="item col<?php echo $i + 3; ?> <?php if ($dayofweek == 1 || $dayofweek == 7) echo 'weekend'; ?> <?php if ($i == $endmonth) echo 'endofmonth'; ?> <?php if ($records1[$row->MaLP][$i]->max == 0) echo 'sold' ?>" onmouseover="ivivu.tooltip.show('6.060.000 VND','1','0','0');">
                                                            <div class="<?php if ($records1[$row->MaLP][$i]->max > 0) echo 'item';?> deal">
                                                                <span class="label"><?php if ($records1[$row->MaLP][$i]->max > 0) echo number_format($records1[$row->MaLP][$i]->gia,  0, ',', '.'); else echo 'SOLD' ?></span>
                                                                <div id="<?php echo $j . '_' . $i; ?>" class="total" style="right: 92%"></div>
																<div class="tooltip_description" style="display:none" title="">
																	<div style="width:38%; align:center; float:left" align="center">
																		<h1 style='background-color: rgb(155, 239, 74); color:black;font-size: 25px;line-spacing:2px;'><?php echo number_format($records1[$row->MaLP][$i]->gia * 1000,  0, ',', '.')?></h1>
																	</div>
																	<div style="width:57%;float:right; align:left;margin-top: 10px">
																		<h4 style="color:rgb(155, 239, 74)"><?php echo $row->Ten; ?></h4>
																	</div>
																	<div style="margin-top: 50px">Include breakfast, airport transfer, welcome fruits basket</div>
																</div>
                                                            </div>
                                                            <div style="display:none" id="description_1_0">Include breakfast, airport transfer, welcome fruits basket</div>
															
                                                        </td>
                                                        <?php
                                                        $dayofweek = $dayofweek + 1;
                                                        if ($dayofweek > 7)
                                                            $dayofweek = 1;
                                                    }
                                                    ?>
                                                </tr>

                                            </tbody>
                                        </table>
                                        <div style="clear: both;"></div></div>
                                    <?php
                                    $j++;
                                endforeach;
                                ?>
                                <div style="clear: both;"></div>
                                <input id="soloaiphong" name="soloaiphong" value="<?php echo $j;?>" type="hidden"/>

                            </div>

                            <div style="clear: both;"></div>
                        </div>
                        <div id="taxnote" style="padding-right:30px;padding-bottom: 10px;margin-top: -13px;color: #000000;">
                            Giá mỗi phòng mỗi đêm chưa bao gồm thuế và phí. <span id="pay_in_vn" style="display:none;"> Đặt phòng tại khách sạn này sẽ được thanh toán bằng Việt Nam đồng (VND). </span> <span id="unit_price"> Đơn vị tính 1.000 đồng</span>
                        </div>
                    </div>



                </div>
                <!--end:box-content -->

            </div>
            <!--end:content container -->
            <div class="clear"></div>
            <!-- End middle content -->
            <div class="footer">
                <!--start:footer -->
                <div class="container_16">
                    <!--start:footer container -->
                    <div class="footer_left">
                        <!--start:footer left part-->
                        <p> &copy; Copyright 2012 <a href="index.php/home" target="_blank">i12 Online Booking | N12~SuperStar</a></p>
                    </div>
                    <!--start:footer left part-->
                    <div class="footer_right">
                        <!--start:footer right part-->
                        <p>Designed and Developed by <a href="http://www.themeflash.com" target="_blank">Themeflash.com</a></p>
                    </div>
                    <!--end:footer right part-->
                </div>
                <!--end:footer container -->
            </div>
            <center>Design Downloaded from <a href="http://www.template4all.com/" title="free website templates" target="_blank">Free Website Templates</a> | <a href="http://www.freethemes4all.com/" title="free css templates" target="_blank">free css templates</a> | <a href="http://www.seodesign.us" title="free psd files" target="_blank">Free PSD Files</a></center>

            <!--end:footer -->
            <script type="text/javascript">
                $('#nextbutton').click(function(){
                    var form_data = {
                        ngay:$('#ngay1').val(), thang:$('#thang1').val(), nam: $('#nam1').val(),
                        songay:$('#songay1').val(), thu:$('#thu').val(),
                        khachsan: $('#makhachsan').val(),
                        ngaybatdau:$('#ngaybatdau').val(), ngayketthuc:$('#ngayketthuc').val(),
                        thangbatdau:$('#thangbatdau').val(), thangketthuc:$('#thangketthuc').val(),
                        nambatdau:$('#nambatdau').val(), namketthuc:$('#namketthuc').val(),
                        date:$('#search-from').val()
                    };
                    $.ajax({
                        url: "<?php echo site_url('datphong/loadbanggia'); ?>",
                        type:"POST",
                        data: form_data,
                        dataType: 'html',
                        success: function(msg){
                            $('#banggia').empty();
                            $('#banggia').append(msg);
                        }
                    });
                }
            );
                $('#prevbutton').click(function(){
                    var form_data = {
                        ngay:$('#ngay2').val(),thang:$('#thang2').val(), nam: $('#nam2').val(),
                        songay:$('#songay2').val(),thu:$('#thu').val(),
                        khachsan: $('#makhachsan').val(),
                        ngaybatdau:$('#ngaybatdau').val(), ngayketthuc:$('#ngayketthuc').val(),
                        thangbatdau:$('#thangbatdau').val(), thangketthuc:$('#thangketthuc').val(),
                        nambatdau:$('#nambatdau').val(), namketthuc:$('#namketthuc').val(),
                        date:$('#search-from').val()                                                                            
                    };
                    $.ajax({
                        url: "<?php echo site_url('datphong/loadbanggia'); ?>",
                        type:"POST",
                        data: form_data,
                        dataType: 'html',
                        success: function(msg){
                            $('#banggia').empty();
                            $('#banggia').append(msg);
                        }
                    });
                }
            );

                //$("form").submit(function() {
                //alert('asa');
                //return false;
                //});<a class="changedate" href="javascript:getDealNo();">Đổi ngày </a>

                $('a').click(function() {
                    var value = $(this).attr("id");
                    if($(this).hasClass('book'))
                    {
                        if($('#ngaybatdau').val()==0)
                        {
                            alert('Quý khách vui lòng chọn số đêm ở');
                            return;
                        }
                        if(parseInt($('#min_nigth_stay_' + value).val())>parseInt($('#sodemo').val()))
                        {
                            var min_nigth_stay = $('#min_nigth_stay_' + value).val();
                            alert('Bạn cần đăng ký ít nhất là  ' + min_nigth_stay + ' ngày.');
                            return;
                        }
                        $('#loaiphong').val(value);
                        var form_data = {
                            loaiphong: $('#loaiphong').val(),
                            ngaybatdau:$('#ngaybatdau').val(), ngayketthuc:$('#ngayketthuc').val(),
                            thangbatdau:$('#thangbatdau').val(), thangketthuc:$('#thangketthuc').val(),
                            nambatdau:$('#nambatdau').val(), namketthuc:$('#namketthuc').val()
                        };
                        $.ajax({
                            url: "<?php echo site_url('datphong/kiemtradatphong'); ?>",
                            type:"POST",
                            data: form_data,
                            dataType: 'html',
                            success: function(msg){
                                if(msg == 1)
                                    $('#myform').submit();
                                else alert('Một trong những ngày bạn chọn đã hết phòng. Vui lòng chọn lại ngày khác.');
                            }
                        });
                    }
                    if($(this).hasClass('changedate'))
                    {                                                                            
                        var form_data = {
                            ngay:$('#search-from').val(),thu:$('#thu').val(),khachsan: $('#makhachsan').val()
                        };
                        $.ajax({
                            url: "<?php echo site_url('datphong/loadbanggiatheongay'); ?>",
                            type:"POST",
                            data: form_data,
                            dataType: 'html',
                            success: function(msg){
                                $('#banggia').empty();
                                $('#banggia').append(msg);
                            }
                        });
                    }

                });
            </script>

    </body>
</html>